package com.yunchang.springboot.mapper.mwsreport;

import com.yunchang.springboot.models.mwsreportbean.MwsMonthlyInventoryHistoryDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 亚马逊api获取每月库存记录表 Mapper 接口
 * </p>
 *
 * @author sjd
 * @since 2020-08-21
 */
public interface IMwsMonthlyInventoryHistoryMapper extends BaseMapper<MwsMonthlyInventoryHistoryDO> {
    String getLatestDay(@Param("sellerId") String sellerId, @Param("area") String area);

    /**
     * 根据时间获取对应的数据
     * @param time
     * @return
     */
    List<MwsMonthlyInventoryHistoryDO> selectByCreateTime(String time);

    /**
     * 根据参数获取endQuantity的和
     * @param sellerId
     * @param sku
     * @param fnSku
     * @param month
     * @param detailedDisposition
     * @return
     */
    Integer selectSumEndQuantityBySellerIdAndSkuAndFnSkuAndMonthAndDetailedDisposition(String sellerId,String sku,String fnSku,String month,String detailedDisposition);


    /**
     * 根据参数获取endQuantity的和,不等于detailedDisposition的值
     * @param sellerId
     * @param sku
     * @param fnSku
     * @param month
     * @param detailedDisposition
     * @return
     */
    Integer selectSumEndQuantityBySellerIdAndSkuAndFnSkuAndMonthAndDetailedDispositionUnequal(String sellerId,String sku,String fnSku,String month,String detailedDisposition);

    /**
     * 根据是否生成财务数据获取对应的数据
     * @param financeStatus
     * @param limitValue
     * @return
     */
    List<MwsMonthlyInventoryHistoryDO> selectByFinanceStatus(Integer financeStatus,Integer limitValue);

    /**
     * 根据mwsMonthlyInventoryHistoryList对象集合更新financeStatus的值
     * @param mwsMonthlyInventoryHistoryList
     * @return
     */
    int updateFinanceStatusByMwsMonthlyInventoryHistoryList(@Param("mwsMonthlyInventoryHistoryList") List<MwsMonthlyInventoryHistoryDO> mwsMonthlyInventoryHistoryList);

}
